#!/usr/bin/perl -w
use strict;
use Net::SMTP_auth;

my $mailhost = 'smtp.qq.com';
my $mailfrom = '1379205553@qq.com';
my @mailto = ('thy_shenzhen@163.com','446789593@qq.com');
my $user = '1379205553@qq.com';
my $passwd = '123456';
my $subject = 'hello';

my $mail_content = "hello,thy,I'm delphi,I sent a mail to you with perl!
It is very interesting!";
my $smtp = Net::SMTP_auth->new($mailhost,Timeout=>120,Debug=>1) or die "Error.\n";
$smtp->auth('LOGIN', $user, $passwd);

foreach my $mailto(@mailto) {
        $smtp->mail($mailfrom);
        $smtp->to($mailto);
        $smtp->data();
        $smtp->datasend("To: $mailto\n");
        $smtp->datasend("From:$mailfrom\n");
        $smtp->datasend("Subject: $subject\n");
        $smtp->datasend("\n");
        $smtp->datasend("$mail_content\n\n");
        $smtp->dataend();
}
$smtp->quit;
